package com.cars.grpc.client.account.controller;

import com.alibaba.fastjson2.JSON;
import com.cars.grpc.client.account.service.HelloClientService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author caoqianfan
 * @date 2024/2/6 10:27
 */
@RestController
public class HelloClientController {
    @Resource
    private HelloClientService helloClientService;

    @GetMapping("/hello/{name}")
    public ResponseEntity<String> satHello(@PathVariable(value = "name") String name) {
        return ResponseEntity.ok(JSON.toJSONString(helloClientService.sayHello(name)));
    }
}
